#pragma once
 
#include "TwEngineDx.h"

float	RandomValue();
DWORD   RandomColor();

struct sParticle 
{
	DWORD  m_BorthTime;
	int	   m_nLifeSpan;
	float  m_nXSpeed;
	float  m_nYSpeed;
	float  m_nSpeedUpX;
	float  m_nSpeedUpY;
	int    m_nPosX;
	int    m_nPosY;
	int	   m_nSize;
	FVERTEX2D m_fVertex[4];
	bool   m_bHaveBirth;

	bool   IsDeath()
	{
		return (m_BorthTime +  m_nLifeSpan < GetTickCount());
	}

	void  SetParticleData(float lifespan,float xSpeed,float ySpeed,float xSpeedUp,float ySpeedUp,int nSize);
	void StartRender();
	void Updata();
	void Render();
	sParticle():
		m_nLifeSpan(0.0f),
		m_nXSpeed(0.0f),
		m_nYSpeed(0.0f),
		m_nSpeedUpX(0.0f),
		m_nSpeedUpY(0.0f),
		m_nPosX(0),
		m_nPosY(0),
		m_bHaveBirth(false){};

};
#define MAX_PARTICLENUM 100
class TwParticle2D
{
public:
	TwParticle2D(void);
	~TwParticle2D(void);

	void InitParticle();
	void Update();

private:
	sParticle		   m_sParticle[MAX_PARTICLENUM];
};
